Option Explicit

Private Const InputQueueSize As Integer = 10   ' 1 byte buffer.
Private Const OutputQueueSize As Integer = 10  ' 1-byte buffer.

Private InputQueue(1 To InputQueueSize) As Byte
Private OutputQueue(1 To OutputQueueSize) As Byte

Private Const Baud As Long = 1200

Private Const NullOutputPin As Byte = 0
'-------------------------------------------------------------------------------
Public Sub OpenSerialPortGPS()

    Call OpenQueue(InputQueue, InputQueueSize)

    Call OpenQueue(OutputQueue, OutputQueueSize)

    If (PortNumber = 3) Then

        ' Inverted logic, no parity, 8 data bits.
        Call DefineCom3(SerialInputPin, NullOutputPin, bx1000_1000)
    End If

    Call OpenCom(PortNumber, Baud, InputQueue, OutputQueue)

End Sub
'-------------------------------------------------------------------------------
Public Function GetByteGPS() As Byte

    Dim Value As Byte

    Call GetQueue(InputQueue, Value, 1)

    GetByteGPS = Value

End Function
'-------------------------------------------------------------------------------
